import matplotlib
import matplotlib.pyplot as plt
import numpy as np


matplotlib.rcParams['ps.useafm'] = True
matplotlib.rcParams['pdf.use14corefonts'] = True
matplotlib.rcParams['text.usetex'] = True

font = {'family' : 'serif',
        'color'  : 'black',
        'weight' : 'normal',
        'size'   : 26,
        }

x1=[50,60,70,80,90]

# y1=[0.4894,0.5202,0.5462,0.546,0.548]
# y2=[0.4022,0.4668,0.5138,0.5414,0.5594]

y1=[0.548,0.546,0.5462,0.5202,0.4894]
y2=[0.5594,0.5414,0.5138,0.4668,0.4022]

std1=[0.011001818,0.006431174,0.007359348,0.005329165,0.005403702]
std2=[0.039544405,0.020846103,0.026018455,0.013705473,0.010480458]

fig, ax = plt.subplots()
# d1,=ax.plot(x1, y1, color='red', linestyle='-', marker='o', markerfacecolor='red', markersize=8)
# d2,=ax.plot(x1, y2, color='blue', linestyle='-', marker='^', markerfacecolor='blue', markersize=8)

d1=ax.errorbar(x1, y1, xerr=None,yerr=std1, ecolor='r',color='red', linestyle='-', marker='o', markerfacecolor='red', markersize=8)
d2=ax.errorbar(x1, y2, xerr=None,yerr=std2, ecolor='b',color='blue', linestyle='-', marker='^', markerfacecolor='blue', markersize=8)

# plt.axis([0,0.6,0.38,0.62])

plt.legend((d1,d2),("PTM","SATM"))
plt.xlim(xmin=48, xmax=92)
plt.ylim(ymin=0.35, ymax=0.6)
plt.xlabel('Precentage of data removed(\%)',fontdict=font)
plt.ylabel('F-measure',fontdict=font)
plt.title('')
plt.rc('font', size=20)
fig.subplots_adjust(hspace=0.0, wspace=0.0, left=0.14, right=0.95,bottom=0.14, top = 0.95)
plt.show()
